<?php
class lib_sys_ad extends lib_base{
	public $table_name = "qc_sys_ad";
    public $pk = "id";

    public function get_city_ads($cond){
        // $cond = "status=1 and city_id={$city_id}";
        $result = $this->findAll(array($cond),'sort asc');
		if($result){
            if($result['img']){
                $v2 = D('upload_file')->get_image($result['img']);
                $v2 = $v2['file_path'];
                $result['img'] = $v2;
            }
            return $result;
        }
        return false;
    }

    public function get_ad_img($name='')
    {   
        $cond = "name='{$name}' and status=1";
        $info = $this->find(array($cond),'id desc');
        $info['img'] = D('upload_file')->get_image_url($info['img']);
        return $info['img'];
    }
    
}